package com.audition.thread.day01;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author xukang
 * @date 2021-03-08 18:09
 */
public class ThreadPoolDemo {

    public static void main(String[] args) {
//        Thread thread = new Thread(new Task());
//        thread.start();
        ExecutorService executorService = Executors.newFixedThreadPool(5);
        for (int i = 0; i < 10000; i++) {
            executorService.execute(new Task());
        }
        executorService.shutdown();
    }

    static class Task implements Runnable {


        @Override
        public void run() {
            System.out.println("Thread Name: " + Thread.currentThread().getName());
        }
    }
}


